﻿@page "/user"
@using NetByDocker.Domain.Model.UserManage
@using NetByDocker.Web.Services

@inject UserService UserService;
@attribute [StreamRendering(true)]

<PageTitle>用户列表</PageTitle>

<h1>Users</h1>

@if (userList is null || userList.Count == 0)
{
    <p>
        <em>没有找到用户数据</em>
    </p>
}
else
{
    <table class="table">
        <thead>
        <tr>
            <th>用户标识</th>
            <th>账号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>学分</th>
        </tr>
        </thead>
        <tbody>
        @foreach (var user in userList)
        {
            <tr>
                <td>@user.Id</td>
                <td>@user.Account</td>
                <td>@user.Name</td>
                <td>@user.Sex</td>
                <td>@user.Credit</td>
            </tr>
        }
        </tbody>
    </table>
}


@code {
    private List<GetUserPageInfoResponse>? userList;

    protected override async Task OnInitializedAsync()
    {
        var result = await UserService.GetPageListAsync();
        userList = result.Rows;
    }
}